package com.panshi.controller;

import com.panshi.service.DynamicService;
import com.panshi.util.CommonResult;
import com.panshi.vo.DynamicVO;
import com.panshi.vo.PageSizeVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@CrossOrigin
public class DynamicController {

    @Autowired
    private DynamicService dynamicService;

    @PostMapping("/dyQu")
    public List<DynamicVO> findDyQuery(@RequestBody PageSizeVO pageSizeVO){
        log.info("查询动态");
        return dynamicService.findDyQuery(pageSizeVO);
    }

    //删除动态表
    @GetMapping("dyDe/{did}")
    public CommonResult<String> deleteDy(@PathVariable int did){
        log.info("删除动态表");
        dynamicService.deleteDy(did);
        return new CommonResult<String>();
    }
}
